<?php
if (!defined('THINK_PATH')) exit;
class IndexAction extends Action
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index()
    {
    	$p = new PublicAction();
    	$p->mainweb();
//        $this->display(THINK_PATH.'/Tpl/Autoindex/hello.html');
    }
    public function center(){
    	$this->image();
    	$this->dymod();
    	$this->display();
    }
	public function dymod()
    {	
    	$showcon = selectModel::getAllShowCon();
    	$flag = array(); //用于标记是否显示图片
    	if(is_array($showcon) && count($showcon)>0){
    		foreach ($showcon as $v){
		    	switch ($v['z_url']){
		    		case 'showmod' :
		    			$flag['showmod'] = 1;
						$showmod[$v ['z_id']] = selectModel::getModConInfoByMid ( $v ['z_id'] );
						break;
					case 'showtit' :
						$alltit = selectModel::getAritcleTitByMid($v ['z_id']);
						$showtits = '<div class="node-list">';
							foreach($alltit as $val){
								$showtits .= '<div class="tit news-item">
  									  	<h2><a href="/www/showmod/index/modid/'.$v['z_id'].'/mean/article/tid/'.$val['tid'].C('HTML_FILE_SUFFIX').'">'.msubstr($val['title'],0,14).'</a></h2>
									  </div>';
							}
							$showtits .= '</div>';
						$showtit[$v ['z_id']] = $showtits;
						break;
					case 'content' :
						$flag['content'] = 1;
						$contents = selectModel::getModConInfoByMid ( $v ['z_id'] );
						$content[$v ['z_id']] = strip_tags($contents ['c_content']);
						break;
					case 'msgboard' :
						break;
					case 'product' :
						break;
		    	}
    		}
    	}
//    	var_dump($flag);
    	$this->assign('showcon',$showcon);
    	$this->assign('content',$content);
    	$this->assign('showmod',$showmod);
    	$this->assign('showtit',$showtit);
    	$this->assign('msgboard',$msgboard);
    	$this->assign('product',$product);
    	$this->assign('flag',$flag);
    }
    public function image()
    {	
    	$images = array(
    		array('name'=>'test1','image'=>'wall1.jpg'),
    		array('name'=>'test2','image'=>'wall2.jpg'),
    		array('name'=>'test3','image'=>'wall3.jpg'),
    		array('name'=>'test4','image'=>'wall4.jpg'),
    		array('name'=>'test5','image'=>'wall5.jpg'),
    		array('name'=>'test5','image'=>'wall6.jpg'),
    		array('name'=>'test5','image'=>'wall7.jpg'),
//    		array('name'=>'test5','image'=>'wall5.jpg'),
    	);
    	$this->assign('images',$images);
    }
     /*
     +----------------------------------------------------------- 
     * 方法不存在时默认操作
     +-----------------------------------------------------------
     */
	public function _empty(){
		$this->redirect('error');
	}
	/*
     +----------------------------------------------------------- 
     * 错误操作提示
     +-----------------------------------------------------------
     */
	public function error(){
		$this->display('./Tpl/default/Index/error.html');
	}
    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv()
    {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }

}
?>